# Contributor: rubicon <rubicon@mailo.com>
# Maintainer: Celeste <cielesti@protonmail.com>
maintainer="Celeste <cielesti@protonmail.com>"
pkgname=emacspeak-server-eflite
pkgver=0_git20200811
pkgrel=1
_gitrev=5a76adf185371ec4e1523a3e860b10f9b9f5cfed
pkgdesc="CMU Flite (festival-lite) speech server for Emacspeak"
url="https://github.com/mgorse/eflite"
arch="all"
license="GPL-2.0-or-later"
makedepends="autoconf automake alsa-lib-dev flite-dev"
install_if="emacspeak flite"
options="!check"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/mgorse/eflite/archive/$_gitrev.tar.gz
	buf-overflow.patch
	include-string.patch
	"
builddir="$srcdir/eflite-$_gitrev"

prepare() {
	default_prepare

	autoupdate
	autoreconf -fvi
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--target=$CTARGET \
		--prefix="$pkgdir"/usr \
		--with-audio=alsa
	make
}

package() {
	local servdir="$pkgdir"/usr/share/emacs/site-lisp/emacspeak/servers

	make DESTDIR="$pkgdir" install
	mkdir -vp "$servdir"
	ln -sv	/usr/bin/eflite "$servdir"/

	install -Dvm644 AUTHORS COPYING CREDITS ChangeLog \
		INSTALL NEWS README eflite_test.txt \
		-t "$pkgdir"/usr/share/doc/$pkgname/

	install -Dvm644 eflite.1 -t "$pkgdir"/usr/share/man/man1/
}

sha512sums="
443bfbb15fafc91e1a44717ac8051b9450bf99535912aaf0a03cf67f9575c704b88e1926bec83ce267246648aa6e8f7dc09b4236874e83ac7026233366fd9c8a  emacspeak-server-eflite-0_git20200811.tar.gz
c598dfe662d5c817032aa32543527b0075c196decd60d2700f9463fbfc586b31c2ddbce1f14aa10827dccadee98f33ad58cc247e31f0ec15720af47f167623e5  buf-overflow.patch
9bee53b733029898eeac716651ba2fedb3129a5fa60062979b422680dfe5c4a121d383a03d223d00642ac3137073ceb0633e77bd81a4452dbcf4aecb61fdc583  include-string.patch
"
